﻿<%@ Page Language="C#" MasterPageFile="~/App_MasterPages/Site.Master" AutoEventWireup="true" 
CodeBehind="Menu.aspx.cs" Inherits="PepsiCo.UI.UnitManagment" Title="Quản trị Menu" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ScriptContent" Runat="Server">
    <script type="text/javascript">
       function onClientContextMenuItemClicking(sender, args)
            {
                var menuItem = args.get_menuItem();
                var treeNode = args.get_node();
                menuItem.get_menu().hide();
               
                switch(menuItem.get_value())
                {
                    case "Add":
                        break;
                    case "Edit":
                        break;
                    case "Delete":
                        var result = confirm("Bạn có muốn xóa Menu: " + treeNode.get_text() + " hay không ? ");
                        args.set_cancel(!result)
                        break;                           
                }
            }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" Runat="Server">
    <div id="divContentMenuAdmin">
        <div class="divSubHeader">
            Hệ thống quản lý Menu
        </div>
        <div style="text-align:center; margin-top:12px;">
            <asp:Label ID="lblMsg1" CssClass="lblMsg" BackColor="#E5EAB4" runat="server" ForeColor="Red" Visible="false" Text=""></asp:Label>
        </div>
        <div>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadTreeViewMenu">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadTreeViewMenu" />
                            <telerik:AjaxUpdatedControl ControlID="lblMsg1" />
                            <telerik:AjaxUpdatedControl  ControlID="CtrEdit"/>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="CtrEdit">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="CtrEdit" />
                            <telerik:AjaxUpdatedControl  ControlID="RadTreeViewMenu"/> 
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
        </div>
        <div class="divframesystemsmenu">
            <div class="divSubHeader">
                Hệ thống Menu
            </div>
            <div id="divSystemMenu">
                <div style="padding:3px;">
                    <telerik:RadTreeView ID="RadTreeViewMenu" runat="server" OnClientContextMenuItemClicking="onClientContextMenuItemClicking"
                         oncontextmenuitemclick="RadTreeViewMenu_ContextMenuItemClick"
                        Skin="WebBlue" Font-Size="12px" Font-Names="Arial">
                        <CollapseAnimation Duration="100" Type="InQuint" />
                        <ContextMenus>
                            <telerik:RadTreeViewContextMenu Skin="WebBlue">
                                <Items>
                                    <telerik:RadMenuItem runat="server" Font-Size="13px" ImageUrl="~/images/i_add.gif" Text="Thêm mới" Value="Add">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem runat="server" Font-Size="13px" ImageUrl="~/images/i_edit.gif" Text="Sửa" Value="Edit" >
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem runat="server" Font-Size="13px" ImageUrl="~/images/i_delete.gif" Text="Xóa" Value="Delete"> 
                                    </telerik:RadMenuItem>
                                </Items>
                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                            </telerik:RadTreeViewContextMenu>
                        </ContextMenus>
                        <ExpandAnimation Duration="300" />
                    </telerik:RadTreeView>
                </div>
                <div style="clear:both"></div>
            </div>
            <div style="clear:both"></div>
        </div>
        <div id="CtrEdit" class="divframe" runat="server" visible="false">
            <div class="divSubHeader">
                    Chi tiết Menu
            </div>
            <div class="divDetailMenu">
                <div style="margin-left:45px; font-size:12px;">
                    <table>
                        <tr>
                            <td style="padding-top:10px;">Tên Menu:</td>
                            <td><asp:TextBox ID="txtMenuName" MaxLength="35" runat="server" CssClass="inputText"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="padding-top:10px">Loại Menu:</td>
                            <td>
                                <asp:DropDownList ID="ddlMenuType" runat="server" CssClass="inputText" Width="187"
                                    onselectedindexchanged="ddlMenuType_SelectedIndexChanged1"
                                    AutoPostBack="True">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr id="Url">
                            <td>
                                <asp:Label ID="lblUrl" runat="server" Text="Nhập Url:"></asp:Label>
                            </td>
                            <td colspan="2"><asp:TextBox ID="txtUrl" runat="server" CssClass="inputText" MaxLength="255"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="padding-top:10px">Thứ tự:</td>
                            <td><asp:TextBox ID="txtOrder" MaxLength="2" runat="server" CssClass="inputText" Width="40"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="padding-top:10px; padding-bottom:15px">Trạng thái:</td>
                            <td>
                                <asp:RadioButton ID="rdbActive" runat="server" GroupName="status" />Kích hoạt
                                <asp:RadioButton ID="rdbNoActive" runat="server" GroupName="status" />Chưa kích hoạt
                            </td>
                        </tr>
                    </table>
                </div>
                <div style="margin-left:100px;font-size:14px;">
                    <div>
                           <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="Error" Display="Dynamic" ControlToValidate="txtMenuName" runat="server" ErrorMessage="(*) Bạn chưa nhập tên Menu"></asp:RequiredFieldValidator>
                    </div>
                    <div>
                           <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="Error"  Display="Dynamic" ControlToValidate="txtOrder" runat="server" ErrorMessage="(*) Bạn chưa nhập thứ tự"></asp:RequiredFieldValidator>
                    </div>
                    <div>
                           <asp:RangeValidator ID="RangeValidator2" ControlToValidate="txtOrder" Display="Dynamic" MinimumValue="1" MaximumValue="20" Type="Integer" runat="server" ValidationGroup="Error" ErrorMessage="(*) Thứ tự phải kiểu số từ 1-->20"></asp:RangeValidator>
                    </div>
                    <div>       
                           <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="(*) Bạn chưa nhập đường dẫn" ControlToValidate="txtUrl" ValidationGroup="Error" Display="Dynamic"></asp:RequiredFieldValidator>
                    </div>
                </div><br />
                <div style="margin-left:90px; margin-bottom:10px">
                    <asp:Button ID="btnSave" CssClass="button" runat="server" ValidationGroup="Error"
                        onclick="btnSave_Click" BorderStyle="None" />
                    <asp:Button ID="btnCancel" CssClass="button" runat="server" Text="Hủy"
                        onclick="btnCancel_Click" BorderStyle="None" />
                    <asp:Button ID="btnClose" CssClass="button" runat="server" Text="Đóng" onclick="btnClose_Click" BorderStyle="None" />   
                </div>
            </div>
        </div>
        <div style="clear:both"></div>
    </div>
</asp:Content>

